package wsn.linklayer.idealwireless;

import inet.base.IHook;
import inet.linklayer.IOutputQueue;
import inet.linklayer.ITrafficConditioner;
import inet.linklayer.IWirelessNic;
import wsn.linklayer.idealwireless.*;

module CC1000IdealWirelessNic like IWirelessNic
{
    parameters:
        @display("i=block/ifcard;bgb=214,335;bgl=53");
        double bitrate @unit("bps");
        string queueType = default("DropTailQueue");    // DropTailQueue, a Diffserv queue, etc.
    gates:
        input upperLayerIn;
        output upperLayerOut;
        input radioIn @labels(IdealAirFrame);
    submodules:
        queue: <queueType> like IOutputQueue {
            parameters:
                @display("p=23,125;q=l2queue");
        }
        mac: CC1000IdealWirelessMac {
            parameters:
                bitrate = bitrate;
                @display("p=98,207");
        }
        radio: CC1000IdealRadio {
            parameters:
                bitrate = bitrate;
                @display("p=98,278");
        }
    connections:
        upperLayerIn --> { @display("m=n"); } --> queue.in;
        mac.upperLayerOut --> { @display("m=n"); } --> upperLayerOut;
        queue.out --> mac.upperLayerIn;
        radioIn --> { @display("m=s"); } --> radio.radioIn;
        radio.upperLayerIn <-- mac.lowerLayerOut;
        radio.upperLayerOut --> mac.lowerLayerIn;
}